package com.ggmc;

import java.awt.BorderLayout;
import java.awt.Container;

import javax.swing.JFrame;
import javax.swing.JScrollBar;

public class MainFrame extends JFrame {
	
	private static final long serialVersionUID = 1L;
	
	public MainFrame(String title) {
		super(title);
		
		///set layout manager
		getContentPane().setLayout(new BorderLayout());
		
		///create output window on rhs
		final OutputPanel outputPanel = new OutputPanel("Contacts Emailed");
		
		///create options panel on lhs
		DetailPanel detailPanel = new DetailPanel();
		
		///get email contact text from DetailsPanel
		detailPanel.addDetailListener(new DetailListener() {
            public void detailEventOccurred(DetailEvent event) {
                String emailAddress = event.getText();

                outputPanel.setDisplayContact(emailAddress);
            }
        });
			
		// add swing components to content pane
		Container c = getContentPane();
		
		c.add(detailPanel, BorderLayout.WEST);
		c.add(outputPanel, BorderLayout.CENTER);
	}
}


